package com.x.client.activity

import android.support.v4.content.ContextCompat
import android.view.View
import android.widget.EditText
import com.alibaba.android.arouter.facade.annotation.Route
import com.gg.baselibrary.BaseActivity
import com.gg.utils.StatusUtils
import com.gg.utils.Utils
import com.gg.widget.navigationbar.DefaultNavigationBar
import com.gg.widget.navigationbar.OnTextChangeListener
import com.socks.library.KLog
import com.x.client.R
import com.x.client.utils.RouterClass
import com.x.client.utils.UIHelper
import kotlinx.android.synthetic.main.activity_sale_car.*

/**
 * Creator : GG
 * Date    : 2018/5/23
 * Mail    : gg.jin.yu@gmai.com
 * Explain :
 */
@Route(path = RouterClass.saleCar)
class SaleCarActivity : BaseActivity(), View.OnClickListener {

    override fun getLayoutRes(): Int = R.layout.activity_sale_car


    override fun initTitle() {
        super.initTitle()
        DefaultNavigationBar.Builder(this)
                .setMiddleText("我要卖车")
                .setLeftIcon(R.drawable.ic_back_black)
                .setMiddleTextColor(ContextCompat.getColor(this, R.color.text_black))
                .setStatusBarColor(ContextCompat.getColor(this, R.color.white))
                .setBackgroundColor(ContextCompat.getColor(this, R.color.white))
                .setStatusBarHeight(StatusUtils.getStatusBarHeight(this))
                .setLeftClickListener(View.OnClickListener { finish() })
                .create()

        StatusUtils.setStatusTextColor(true, this)
        StatusUtils.setStatusBar(this, false, false)
    }

    override fun initView() {
        UIHelper.setAccessible(view = brandSeries, text = "品牌车系", description = "", descriptionColor = ContextCompat.getColor(this, R.color.text_orange), onClickListener = this)

        UIHelper.setAccessible(view = licenseDate, text = "上牌时间", description = "", descriptionColor = ContextCompat.getColor(this, R.color.text_orange), onClickListener = this)

        UIHelper.setAccessible(view = licenseCity, text = "牌照所在地", description = "", descriptionColor = ContextCompat.getColor(this, R.color.text_orange), onClickListener = this)

        val mileageEdit = mileage.findViewById<EditText>(R.id.input)
        Utils.setEditFilter(mileageEdit, 4)
        UIHelper.setEditableAccessible(view = mileage, text = "行驶里程", description = "万公里", textWatcher = object : OnTextChangeListener {
            override fun textChange(t: String?) {
                KLog.w("change", t)
            }

        })
    }

    override fun initData() {
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.brandSeries -> {

            }
            R.id.licenseDate -> {

            }
            R.id.licenseCity -> {

            }
        }
    }
}